CREATE DATABASE [TaskConnect.mdf]
GO 

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Tags]    Script Date: 01/21/2011 17:28:53 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Tags]') AND type in (N'U'))
DROP TABLE [dbo].[Tags]
GO

/****** Object:  Table [dbo].[Comments]    Script Date: 01/21/2011 17:26:52 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Comments]') AND type in (N'U'))
DROP TABLE [dbo].[Comments]
GO

/****** Object:  Table [dbo].[NestedSet]    Script Date: 01/21/2011 17:28:09 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NestedSet]') AND type in (N'U'))
DROP TABLE [dbo].[NestedSet]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Ace_Permissions_Acl]') AND parent_object_id = OBJECT_ID(N'[dbo].[Ace_Permissions]'))
ALTER TABLE [dbo].[Ace_Permissions] DROP CONSTRAINT [Ace_Permissions_Acl]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Ace_Permissions_Permissions]') AND parent_object_id = OBJECT_ID(N'[dbo].[Ace_Permissions]'))
ALTER TABLE [dbo].[Ace_Permissions] DROP CONSTRAINT [Ace_Permissions_Permissions]
GO

/****** Object:  Table [dbo].[Acl]    Script Date: 01/21/2011 17:26:10 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Acl]') AND type in (N'U'))
DROP TABLE [dbo].[Acl]
GO

/****** Object:  Table [dbo].[Ace_Permissions]    Script Date: 01/21/2011 17:26:06 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Ace_Permissions]') AND type in (N'U'))
DROP TABLE [dbo].[Ace_Permissions]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[TypeConstraint3]') AND parent_object_id = OBJECT_ID(N'[dbo].[Bugs]'))
ALTER TABLE [dbo].[Bugs] DROP CONSTRAINT [TypeConstraint3]
GO

/****** Object:  Table [dbo].[Bugs]    Script Date: 01/21/2011 17:26:21 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Bugs]') AND type in (N'U'))
DROP TABLE [dbo].[Bugs]
GO

/****** Object:  Table [dbo].[CategoryColors]    Script Date: 01/21/2011 17:26:26 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CategoryColors]') AND type in (N'U'))
DROP TABLE [dbo].[CategoryColors]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Children_PermissionSet_Permissions]') AND parent_object_id = OBJECT_ID(N'[dbo].[Children_PermissionSet]'))
ALTER TABLE [dbo].[Children_PermissionSet] DROP CONSTRAINT [Children_PermissionSet_Permissions]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Children_PermissionSet_PermissionSet]') AND parent_object_id = OBJECT_ID(N'[dbo].[Children_PermissionSet]'))
ALTER TABLE [dbo].[Children_PermissionSet] DROP CONSTRAINT [Children_PermissionSet_PermissionSet]
GO

/****** Object:  Table [dbo].[Children_PermissionSet]    Script Date: 01/21/2011 17:26:43 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Children_PermissionSet]') AND type in (N'U'))
DROP TABLE [dbo].[Children_PermissionSet]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Children_Requirement_Requirements]') AND parent_object_id = OBJECT_ID(N'[dbo].[Children_Requirement]'))
ALTER TABLE [dbo].[Children_Requirement] DROP CONSTRAINT [Children_Requirement_Requirements]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Children_Requirement_Tickets]') AND parent_object_id = OBJECT_ID(N'[dbo].[Children_Requirement]'))
ALTER TABLE [dbo].[Children_Requirement] DROP CONSTRAINT [Children_Requirement_Tickets]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Children_Requirement_Tickets1]') AND parent_object_id = OBJECT_ID(N'[dbo].[Children_Requirement]'))
ALTER TABLE [dbo].[Children_Requirement] DROP CONSTRAINT [Children_Requirement_Tickets1]
GO

/****** Object:  Table [dbo].[Children_Requirement]    Script Date: 01/21/2011 17:26:47 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Children_Requirement]') AND type in (N'U'))
DROP TABLE [dbo].[Children_Requirement]
GO

/****** Object:  Table [dbo].[ChangeSets]    Script Date: 01/21/2011 17:26:33 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ChangeSets]') AND type in (N'U'))
DROP TABLE [dbo].[ChangeSets]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Children_Parent_Milestones]') AND parent_object_id = OBJECT_ID(N'[dbo].[Children_Parent]'))
ALTER TABLE [dbo].[Children_Parent] DROP CONSTRAINT [Children_Parent_Milestones]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Children_Parent_Milestones1]') AND parent_object_id = OBJECT_ID(N'[dbo].[Children_Parent]'))
ALTER TABLE [dbo].[Children_Parent] DROP CONSTRAINT [Children_Parent_Milestones1]
GO

/****** Object:  Table [dbo].[Children_Parent]    Script Date: 01/21/2011 17:26:39 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Children_Parent]') AND type in (N'U'))
DROP TABLE [dbo].[Children_Parent]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Milestone_Comments]') AND parent_object_id = OBJECT_ID(N'[dbo].[Comments]'))
ALTER TABLE [dbo].[Comments] DROP CONSTRAINT [Milestone_Comments]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Ticket_Comments]') AND parent_object_id = OBJECT_ID(N'[dbo].[Comments]'))
ALTER TABLE [dbo].[Comments] DROP CONSTRAINT [Ticket_Comments]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[ContingencyPlans_Risk_Risks]') AND parent_object_id = OBJECT_ID(N'[dbo].[ContingencyPlans_Risk]'))
ALTER TABLE [dbo].[ContingencyPlans_Risk] DROP CONSTRAINT [ContingencyPlans_Risk_Risks]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[ContingencyPlans_Risk_Tickets]') AND parent_object_id = OBJECT_ID(N'[dbo].[ContingencyPlans_Risk]'))
ALTER TABLE [dbo].[ContingencyPlans_Risk] DROP CONSTRAINT [ContingencyPlans_Risk_Tickets]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[ContingencyPlans_Risk_Tickets1]') AND parent_object_id = OBJECT_ID(N'[dbo].[ContingencyPlans_Risk]'))
ALTER TABLE [dbo].[ContingencyPlans_Risk] DROP CONSTRAINT [ContingencyPlans_Risk_Tickets1]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[ContingencyPlans_Risk]    Script Date: 01/21/2011 17:26:56 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ContingencyPlans_Risk]') AND type in (N'U'))
DROP TABLE [dbo].[ContingencyPlans_Risk]
GO


USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[TypeConstraint2]') AND parent_object_id = OBJECT_ID(N'[dbo].[MeetingRequests]'))
ALTER TABLE [dbo].[MeetingRequests] DROP CONSTRAINT [TypeConstraint2]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[MeetingRequests]    Script Date: 01/21/2011 17:27:00 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MeetingRequests]') AND type in (N'U'))
DROP TABLE [dbo].[MeetingRequests]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Milestone_Requirement_Milestones]') AND parent_object_id = OBJECT_ID(N'[dbo].[Milestone_Requirement]'))
ALTER TABLE [dbo].[Milestone_Requirement] DROP CONSTRAINT [Milestone_Requirement_Milestones]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Milestone_Requirement_Requirements]') AND parent_object_id = OBJECT_ID(N'[dbo].[Milestone_Requirement]'))
ALTER TABLE [dbo].[Milestone_Requirement] DROP CONSTRAINT [Milestone_Requirement_Requirements]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Milestone_Requirement_Tickets]') AND parent_object_id = OBJECT_ID(N'[dbo].[Milestone_Requirement]'))
ALTER TABLE [dbo].[Milestone_Requirement] DROP CONSTRAINT [Milestone_Requirement_Tickets]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Milestone_Requirement]    Script Date: 01/21/2011 17:27:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Milestone_Requirement]') AND type in (N'U'))
DROP TABLE [dbo].[Milestone_Requirement]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[MitigationPlans_Risk_Risks]') AND parent_object_id = OBJECT_ID(N'[dbo].[MitigationPlans_Risk]'))
ALTER TABLE [dbo].[MitigationPlans_Risk] DROP CONSTRAINT [MitigationPlans_Risk_Risks]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[MitigationPlans_Risk_Tickets]') AND parent_object_id = OBJECT_ID(N'[dbo].[MitigationPlans_Risk]'))
ALTER TABLE [dbo].[MitigationPlans_Risk] DROP CONSTRAINT [MitigationPlans_Risk_Tickets]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[MitigationPlans_Risk_Tickets1]') AND parent_object_id = OBJECT_ID(N'[dbo].[MitigationPlans_Risk]'))
ALTER TABLE [dbo].[MitigationPlans_Risk] DROP CONSTRAINT [MitigationPlans_Risk_Tickets1]
GO

/****** Object:  Table [dbo].[MitigationPlans_Risk]    Script Date: 01/21/2011 17:28:06 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MitigationPlans_Risk]') AND type in (N'U'))
DROP TABLE [dbo].[MitigationPlans_Risk]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Project_TeamMember_Assignments]') AND parent_object_id = OBJECT_ID(N'[dbo].[Project_TeamMember]'))
ALTER TABLE [dbo].[Project_TeamMember] DROP CONSTRAINT [Project_TeamMember_Assignments]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[Project_TeamMember_Projects]') AND parent_object_id = OBJECT_ID(N'[dbo].[Project_TeamMember]'))
ALTER TABLE [dbo].[Project_TeamMember] DROP CONSTRAINT [Project_TeamMember_Projects]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Project_TeamMember]    Script Date: 01/21/2011 17:28:28 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Project_TeamMember]') AND type in (N'U'))
DROP TABLE [dbo].[Project_TeamMember]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[TypeConstraint6]') AND parent_object_id = OBJECT_ID(N'[dbo].[PermissionSet]'))
ALTER TABLE [dbo].[PermissionSet] DROP CONSTRAINT [TypeConstraint6]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[PermissionSet]    Script Date: 01/21/2011 17:28:23 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PermissionSet]') AND type in (N'U'))
DROP TABLE [dbo].[PermissionSet]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[TypeConstraint4]') AND parent_object_id = OBJECT_ID(N'[dbo].[Requirements]'))
ALTER TABLE [dbo].[Requirements] DROP CONSTRAINT [TypeConstraint4]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Requirements]    Script Date: 01/21/2011 17:28:43 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Requirements]') AND type in (N'U'))
DROP TABLE [dbo].[Requirements]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[TypeConstraint5]') AND parent_object_id = OBJECT_ID(N'[dbo].[Projects]'))
ALTER TABLE [dbo].[Projects] DROP CONSTRAINT [TypeConstraint5]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Projects]    Script Date: 01/21/2011 17:28:31 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Projects]') AND type in (N'U'))
DROP TABLE [dbo].[Projects]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[RelatedTickets_Risk_Risks]') AND parent_object_id = OBJECT_ID(N'[dbo].[RelatedTickets_Risk]'))
ALTER TABLE [dbo].[RelatedTickets_Risk] DROP CONSTRAINT [RelatedTickets_Risk_Risks]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[RelatedTickets_Risk_Tickets]') AND parent_object_id = OBJECT_ID(N'[dbo].[RelatedTickets_Risk]'))
ALTER TABLE [dbo].[RelatedTickets_Risk] DROP CONSTRAINT [RelatedTickets_Risk_Tickets]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[RelatedTickets_Risk_Tickets1]') AND parent_object_id = OBJECT_ID(N'[dbo].[RelatedTickets_Risk]'))
ALTER TABLE [dbo].[RelatedTickets_Risk] DROP CONSTRAINT [RelatedTickets_Risk_Tickets1]
GO

/****** Object:  Table [dbo].[RelatedTickets_Risk]    Script Date: 01/21/2011 17:28:35 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RelatedTickets_Risk]') AND type in (N'U'))
DROP TABLE [dbo].[RelatedTickets_Risk]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[TypeConstraint1]') AND parent_object_id = OBJECT_ID(N'[dbo].[Risks]'))
ALTER TABLE [dbo].[Risks] DROP CONSTRAINT [TypeConstraint1]
GO

/****** Object:  Table [dbo].[Risks]    Script Date: 01/21/2011 17:28:48 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Risks]') AND type in (N'U'))
DROP TABLE [dbo].[Risks]
GO

USE [TaskConnect.mdf]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[TypeConstraint]') AND parent_object_id = OBJECT_ID(N'[dbo].[Tasks]'))
ALTER TABLE [dbo].[Tasks] DROP CONSTRAINT [TypeConstraint]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Tasks]    Script Date: 01/21/2011 17:28:58 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Tasks]') AND type in (N'U'))
DROP TABLE [dbo].[Tasks]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Assignments]    Script Date: 01/21/2011 17:26:16 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Assignments]') AND type in (N'U'))
DROP TABLE [dbo].[Assignments]
GO

/****** Object:  Table [dbo].[Tickets]    Script Date: 01/21/2011 17:29:02 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Tickets]') AND type in (N'U'))
DROP TABLE [dbo].[Tickets]
GO

/****** Object:  Table [dbo].[Milestones]    Script Date: 01/21/2011 17:28:02 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Milestones]') AND type in (N'U'))
DROP TABLE [dbo].[Milestones]
GO

/****** Object:  Table [dbo].[Permissions]    Script Date: 01/21/2011 17:28:19 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Permissions]') AND type in (N'U'))
DROP TABLE [dbo].[Permissions]
GO

/****** Object:  Table [dbo].[Acl]    Script Date: 01/21/2011 17:26:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Acl](
	[ID] [uniqueidentifier] NOT NULL,
	[RoleName] [nvarchar](4000) NULL,
	[UserName] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Permissions]    Script Date: 01/21/2011 17:28:19 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Permissions](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[PermissionSet]    Script Date: 01/21/2011 17:28:24 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[PermissionSet](
	[ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[PermissionSet]  WITH CHECK ADD  CONSTRAINT [TypeConstraint6] FOREIGN KEY([ID])
REFERENCES [dbo].[Permissions] ([ID])
GO

ALTER TABLE [dbo].[PermissionSet] CHECK CONSTRAINT [TypeConstraint6]
GO

/****** Object:  Table [dbo].[Tickets]    Script Date: 01/21/2011 17:29:02 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Tickets](
	[AssignedTo] [nvarchar](4000) NOT NULL,
	[ClosedDate] [datetime] NULL,
	[Description] [nvarchar](4000) NULL,
	[ID] [uniqueidentifier] NOT NULL,
	[OpenDate] [datetime] NOT NULL,
	[Reporter] [nvarchar](4000) NOT NULL,
	[Title] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Milestones]    Script Date: 01/21/2011 17:28:02 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Milestones](
	[ClosedDate] [datetime] NULL,
	[DueDate] [datetime] NULL,
	[ID] [uniqueidentifier] NOT NULL,
	[OpenDate] [datetime] NOT NULL,
	[Reporter] [nvarchar](4000) NOT NULL,
	[StartDate] [datetime] NULL,
	[Title] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Projects]    Script Date: 01/21/2011 17:28:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Projects](
	[ID] [uniqueidentifier] NOT NULL,
	[Owner] [nvarchar](4000) NOT NULL,
	[ScmType] [nvarchar](4000) NULL,
	[ScmUrl] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Projects]  WITH CHECK ADD  CONSTRAINT [TypeConstraint5] FOREIGN KEY([ID])
REFERENCES [dbo].[Milestones] ([ID])
GO

ALTER TABLE [dbo].[Projects] CHECK CONSTRAINT [TypeConstraint5]
GO

/****** Object:  Table [dbo].[Tasks]    Script Date: 01/21/2011 17:28:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Tasks](
	[ClosedDate] [datetime] NULL,
	[ID] [uniqueidentifier] NOT NULL,
	[IsRecursive] [bit] NOT NULL,
	[Progress] [real] NOT NULL,
	[RecursiveEndDate] [datetime] NULL,
	[StartDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Tasks]  WITH CHECK ADD  CONSTRAINT [TypeConstraint] FOREIGN KEY([ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[Tasks] CHECK CONSTRAINT [TypeConstraint]
GO
USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Requirements]    Script Date: 01/21/2011 17:28:43 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Requirements](
	[BusinessValue] [real] NOT NULL,
	[ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Requirements]  WITH CHECK ADD  CONSTRAINT [TypeConstraint4] FOREIGN KEY([ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[Requirements] CHECK CONSTRAINT [TypeConstraint4]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Risks]    Script Date: 01/21/2011 17:28:48 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Risks](
	[ClosedDate] [datetime] NULL,
	[ID] [uniqueidentifier] NOT NULL,
	[Impact] [float] NOT NULL,
	[IsRecursive] [bit] NOT NULL,
	[Possibility] [float] NOT NULL,
	[Progress] [real] NOT NULL,
	[RecursiveEndDate] [datetime] NULL,
	[RootCause] [nvarchar](4000) NULL,
	[StartDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Risks]  WITH CHECK ADD  CONSTRAINT [TypeConstraint1] FOREIGN KEY([ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[Risks] CHECK CONSTRAINT [TypeConstraint1]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Ace_Permissions]    Script Date: 01/21/2011 17:26:06 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Ace_Permissions](
	[Ace_ID] [uniqueidentifier] NOT NULL,
	[Permissions_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[Permissions_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Ace_Permissions]  WITH CHECK ADD  CONSTRAINT [Ace_Permissions_Acl] FOREIGN KEY([Ace_ID])
REFERENCES [dbo].[Acl] ([ID])
GO

ALTER TABLE [dbo].[Ace_Permissions] CHECK CONSTRAINT [Ace_Permissions_Acl]
GO

ALTER TABLE [dbo].[Ace_Permissions]  WITH CHECK ADD  CONSTRAINT [Ace_Permissions_Permissions] FOREIGN KEY([Permissions_ID])
REFERENCES [dbo].[Permissions] ([ID])
GO

ALTER TABLE [dbo].[Ace_Permissions] CHECK CONSTRAINT [Ace_Permissions_Permissions]
GO

/****** Object:  Table [dbo].[Assignments]    Script Date: 01/21/2011 17:26:16 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Assignments](
	[AvailableHours] [real] NOT NULL,
	[DisplayName] [nvarchar](4000) NULL,
	[Email] [nvarchar](4000) NULL,
	[ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Bugs]    Script Date: 01/21/2011 17:26:21 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Bugs](
	[ID] [uniqueidentifier] NOT NULL,
	[ReproStep] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Bugs]  WITH CHECK ADD  CONSTRAINT [TypeConstraint3] FOREIGN KEY([ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[Bugs] CHECK CONSTRAINT [TypeConstraint3]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[CategoryColors]    Script Date: 01/21/2011 17:26:26 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[CategoryColors](
	[ID] [uniqueidentifier] NOT NULL,
	[PreferredColor] [nvarchar](4000) NULL,
	[User] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[ChangeSets]    Script Date: 01/21/2011 17:26:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ChangeSets](
	[ChangedFileList] [nvarchar](4000) NULL,
	[ID] [uniqueidentifier] NOT NULL,
	[TicketId] [uniqueidentifier] NOT NULL,
	[Title] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Children_Parent]    Script Date: 01/21/2011 17:26:39 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Children_Parent](
	[Children_ID] [uniqueidentifier] NOT NULL,
	[Parent_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[Children_ID] ASC,
	[Parent_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Children_Parent]  WITH CHECK ADD  CONSTRAINT [Children_Parent_Milestones] FOREIGN KEY([Children_ID])
REFERENCES [dbo].[Milestones] ([ID])
GO

ALTER TABLE [dbo].[Children_Parent] CHECK CONSTRAINT [Children_Parent_Milestones]
GO

ALTER TABLE [dbo].[Children_Parent]  WITH CHECK ADD  CONSTRAINT [Children_Parent_Milestones1] FOREIGN KEY([Parent_ID])
REFERENCES [dbo].[Milestones] ([ID])
GO

ALTER TABLE [dbo].[Children_Parent] CHECK CONSTRAINT [Children_Parent_Milestones1]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Children_PermissionSet]    Script Date: 01/21/2011 17:26:43 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Children_PermissionSet](
	[Children_ID] [uniqueidentifier] NOT NULL,
	[PermissionSet_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[Children_ID] ASC,
	[PermissionSet_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Children_PermissionSet]  WITH CHECK ADD  CONSTRAINT [Children_PermissionSet_Permissions] FOREIGN KEY([Children_ID])
REFERENCES [dbo].[Permissions] ([ID])
GO

ALTER TABLE [dbo].[Children_PermissionSet] CHECK CONSTRAINT [Children_PermissionSet_Permissions]
GO

ALTER TABLE [dbo].[Children_PermissionSet]  WITH CHECK ADD  CONSTRAINT [Children_PermissionSet_PermissionSet] FOREIGN KEY([PermissionSet_ID])
REFERENCES [dbo].[PermissionSet] ([ID])
GO

ALTER TABLE [dbo].[Children_PermissionSet] CHECK CONSTRAINT [Children_PermissionSet_PermissionSet]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Children_Requirement]    Script Date: 01/21/2011 17:26:47 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Children_Requirement](
	[Children_ID] [uniqueidentifier] NOT NULL,
	[Requirement_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[Children_ID] ASC,
	[Requirement_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Children_Requirement]  WITH CHECK ADD  CONSTRAINT [Children_Requirement_Requirements] FOREIGN KEY([Requirement_ID])
REFERENCES [dbo].[Requirements] ([ID])
GO

ALTER TABLE [dbo].[Children_Requirement] CHECK CONSTRAINT [Children_Requirement_Requirements]
GO

ALTER TABLE [dbo].[Children_Requirement]  WITH CHECK ADD  CONSTRAINT [Children_Requirement_Tickets] FOREIGN KEY([Children_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[Children_Requirement] CHECK CONSTRAINT [Children_Requirement_Tickets]
GO

ALTER TABLE [dbo].[Children_Requirement]  WITH CHECK ADD  CONSTRAINT [Children_Requirement_Tickets1] FOREIGN KEY([Requirement_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[Children_Requirement] CHECK CONSTRAINT [Children_Requirement_Tickets1]
GO

/****** Object:  Table [dbo].[Comments]    Script Date: 01/21/2011 17:26:52 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Comments](
	[CommentDate] [datetime] NOT NULL,
	[Discriminator] [nvarchar](4000) NOT NULL,
	[ID] [uniqueidentifier] NOT NULL,
	[Milestone_ID] [uniqueidentifier] NULL,
	[PostId] [uniqueidentifier] NOT NULL,
	[PostType] [nvarchar](4000) NULL,
	[Text] [nvarchar](4000) NULL,
	[Ticket_ID] [uniqueidentifier] NULL,
	[User] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Comments]  WITH CHECK ADD  CONSTRAINT [Milestone_Comments] FOREIGN KEY([Milestone_ID])
REFERENCES [dbo].[Milestones] ([ID])
GO

ALTER TABLE [dbo].[Comments] CHECK CONSTRAINT [Milestone_Comments]
GO

ALTER TABLE [dbo].[Comments]  WITH CHECK ADD  CONSTRAINT [Ticket_Comments] FOREIGN KEY([Ticket_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[Comments] CHECK CONSTRAINT [Ticket_Comments]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[MeetingRequests]    Script Date: 01/21/2011 17:27:00 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MeetingRequests](
	[Host] [nvarchar](4000) NULL,
	[ID] [uniqueidentifier] NOT NULL,
	[MeetingNote] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[MeetingRequests]  WITH CHECK ADD  CONSTRAINT [TypeConstraint2] FOREIGN KEY([ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[MeetingRequests] CHECK CONSTRAINT [TypeConstraint2]
GO


USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[Milestone_Requirement]    Script Date: 01/21/2011 17:27:04 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Milestone_Requirement](
	[Milestone_ID] [uniqueidentifier] NOT NULL,
	[Requirement_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[Requirement_ID] ASC,
	[Milestone_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Milestone_Requirement]  WITH CHECK ADD  CONSTRAINT [Milestone_Requirement_Milestones] FOREIGN KEY([Milestone_ID])
REFERENCES [dbo].[Milestones] ([ID])
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[Milestone_Requirement] CHECK CONSTRAINT [Milestone_Requirement_Milestones]
GO

ALTER TABLE [dbo].[Milestone_Requirement]  WITH CHECK ADD  CONSTRAINT [Milestone_Requirement_Requirements] FOREIGN KEY([Requirement_ID])
REFERENCES [dbo].[Requirements] ([ID])
GO

ALTER TABLE [dbo].[Milestone_Requirement] CHECK CONSTRAINT [Milestone_Requirement_Requirements]
GO

ALTER TABLE [dbo].[Milestone_Requirement]  WITH CHECK ADD  CONSTRAINT [Milestone_Requirement_Tickets] FOREIGN KEY([Requirement_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[Milestone_Requirement] CHECK CONSTRAINT [Milestone_Requirement_Tickets]
GO

/****** Object:  Table [dbo].[MitigationPlans_Risk]    Script Date: 01/21/2011 17:28:06 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MitigationPlans_Risk](
	[MitigationPlans_ID] [uniqueidentifier] NOT NULL,
	[Risk_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[MitigationPlans_ID] ASC,
	[Risk_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[MitigationPlans_Risk]  WITH CHECK ADD  CONSTRAINT [MitigationPlans_Risk_Risks] FOREIGN KEY([Risk_ID])
REFERENCES [dbo].[Risks] ([ID])
GO

ALTER TABLE [dbo].[MitigationPlans_Risk] CHECK CONSTRAINT [MitigationPlans_Risk_Risks]
GO

ALTER TABLE [dbo].[MitigationPlans_Risk]  WITH CHECK ADD  CONSTRAINT [MitigationPlans_Risk_Tickets] FOREIGN KEY([MitigationPlans_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[MitigationPlans_Risk] CHECK CONSTRAINT [MitigationPlans_Risk_Tickets]
GO

ALTER TABLE [dbo].[MitigationPlans_Risk]  WITH CHECK ADD  CONSTRAINT [MitigationPlans_Risk_Tickets1] FOREIGN KEY([Risk_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[MitigationPlans_Risk] CHECK CONSTRAINT [MitigationPlans_Risk_Tickets1]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[NestedSet]    Script Date: 01/21/2011 17:28:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[NestedSet](
	[ID] [uniqueidentifier] NOT NULL,
	[Lower] [int] NOT NULL,
	[NodeId] [uniqueidentifier] NOT NULL,
	[Upper] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Project_TeamMember]    Script Date: 01/21/2011 17:28:28 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Project_TeamMember](
	[Project_ID] [uniqueidentifier] NOT NULL,
	[TeamMember_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[TeamMember_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Project_TeamMember]  WITH CHECK ADD  CONSTRAINT [Project_TeamMember_Assignments] FOREIGN KEY([TeamMember_ID])
REFERENCES [dbo].[Assignments] ([ID])
GO

ALTER TABLE [dbo].[Project_TeamMember] CHECK CONSTRAINT [Project_TeamMember_Assignments]
GO

ALTER TABLE [dbo].[Project_TeamMember]  WITH CHECK ADD  CONSTRAINT [Project_TeamMember_Projects] FOREIGN KEY([Project_ID])
REFERENCES [dbo].[Projects] ([ID])
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[Project_TeamMember] CHECK CONSTRAINT [Project_TeamMember_Projects]
GO

USE [TaskConnect.mdf]
GO

/****** Object:  Table [dbo].[RelatedTickets_Risk]    Script Date: 01/21/2011 17:28:35 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[RelatedTickets_Risk](
	[RelatedTickets_ID] [uniqueidentifier] NOT NULL,
	[Risk_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[RelatedTickets_ID] ASC,
	[Risk_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[RelatedTickets_Risk]  WITH CHECK ADD  CONSTRAINT [RelatedTickets_Risk_Risks] FOREIGN KEY([Risk_ID])
REFERENCES [dbo].[Risks] ([ID])
GO

ALTER TABLE [dbo].[RelatedTickets_Risk] CHECK CONSTRAINT [RelatedTickets_Risk_Risks]
GO

ALTER TABLE [dbo].[RelatedTickets_Risk]  WITH CHECK ADD  CONSTRAINT [RelatedTickets_Risk_Tickets] FOREIGN KEY([RelatedTickets_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[RelatedTickets_Risk] CHECK CONSTRAINT [RelatedTickets_Risk_Tickets]
GO

ALTER TABLE [dbo].[RelatedTickets_Risk]  WITH CHECK ADD  CONSTRAINT [RelatedTickets_Risk_Tickets1] FOREIGN KEY([Risk_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[RelatedTickets_Risk] CHECK CONSTRAINT [RelatedTickets_Risk_Tickets1]
GO

/****** Object:  Table [dbo].[Tags]    Script Date: 01/21/2011 17:28:53 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Tags](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[ContingencyPlans_Risk]    Script Date: 01/21/2011 17:26:56 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ContingencyPlans_Risk](
	[ContingencyPlans_ID] [uniqueidentifier] NOT NULL,
	[Risk_ID] [uniqueidentifier] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ContingencyPlans_ID] ASC,
	[Risk_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[ContingencyPlans_Risk]  WITH CHECK ADD  CONSTRAINT [ContingencyPlans_Risk_Risks] FOREIGN KEY([Risk_ID])
REFERENCES [dbo].[Risks] ([ID])
GO

ALTER TABLE [dbo].[ContingencyPlans_Risk] CHECK CONSTRAINT [ContingencyPlans_Risk_Risks]
GO

ALTER TABLE [dbo].[ContingencyPlans_Risk]  WITH CHECK ADD  CONSTRAINT [ContingencyPlans_Risk_Tickets] FOREIGN KEY([ContingencyPlans_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[ContingencyPlans_Risk] CHECK CONSTRAINT [ContingencyPlans_Risk_Tickets]
GO

ALTER TABLE [dbo].[ContingencyPlans_Risk]  WITH CHECK ADD  CONSTRAINT [ContingencyPlans_Risk_Tickets1] FOREIGN KEY([Risk_ID])
REFERENCES [dbo].[Tickets] ([ID])
GO

ALTER TABLE [dbo].[ContingencyPlans_Risk] CHECK CONSTRAINT [ContingencyPlans_Risk_Tickets1]
GO
